package com.test2;

import org.junit.Test;

@FunctionalInterface
interface MyInterface {
    void fun();

    default void defaultFun() {
        System.out.println("调用default方法");
    }

    static void staticFun() {
        System.out.println("调用static方法");
    }
}

class MyClass implements MyInterface {
    @Override
    public void fun() {
        System.out.println("调用fun方法");
    }
}

public class MyTest_01 {

    @Test
    public void test1() {
        MyInterface test = new MyClass();
        test.fun();
        test.defaultFun();
    }

    @Test
    public void test2() {
        MyInterface test = () -> {
            System.out.println("调用fun方法");
        };
        test.fun();
        MyInterface.staticFun();
    }
}
